<template lang="pug">
  div
    s-table(
      ref="table"
      :column="tableObj.column"
      :filterProps="{items: filterItems}"
      :queryFn="tableObj.getList"
      rowKey="devId"
      title="设备运维"
      )
      .table-operator(slot="table-operator")
        | 最近一次巡检时间：2020/01/01 23:00:00
      template(slot="devType" slot-scope="text, scope") {{dictFilter(text, 'SCEN_TASK_WAY')}}
      template(slot="netType" slot-scope="text, scope") {{dictFilter(text, 'SCEN_NET_TYPE')}}
</template>
<script>
import { STable } from '@/components'
import { maintainList } from '@/api/device'

const column = [
  {
    prop: 'devType',
    label: '设备类型'
  },
  {
    prop: 'devCode',
    label: '设备编号'
  },
  {
    prop: 'devName',
    label: '设备名称'
  },
  {
    prop: 'netType',
    label: '当前状态',
    align: 'center'
  },
  {
    prop: 'medinsName',
    label: '所属科室'
  },
  {
    prop: 'loc',
    label: '安装位置'
  },
  {
    prop: 'devIp',
    label: '设备IP',
    align: 'center'
  }
]

export default {
  name: 'DeviceMaintainList',
  components: {
    STable
  },
  data () {
    return {
      tableObj: {
        column,
        getList: maintainList
      }
    }
  },
  computed: {
    filterItems () {
      return [
        {
          key: 'devType',
          label: '设备类型',
          type: 'selectdict',
          dictKey: 'devType'
        },
        {
          key: 'netStas',
          label: '网络状态',
          type: 'selectdict',
          dictKey: 'SCEN_NET_TYPE'
        }
      ]
    }
  },
  created () {
  },
  methods: {
    // 刷新表格
    refreshTable (flag = false) {
      this.$refs.table.refresh(flag)
    }
  }
}
</script>
